class Money implements Cloneable{
    public double money = 12.66;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
public class Student implements Comparable<Student>,Cloneable{

        public String name;
        public int age;
        public int score;

        Money m = new Money();

        public Student(String name, int age, int score) {
            this.name = name;
            this.age = age;
            this.score = score;
        }

        @Override
        public String toString() {
            return "Student{" +
                    "name='" + name + '\'' +
                    ", age=" + age +
                    ", score=" + score +
                    '}';
        }

        @Override
        public int compareTo(Student o) {
            if(this.age > o.age) {
                return 1;
            }else if(this.age < o.age) {
                return -1;
            }else {
                return 0;
            }
            //甚至年龄的比较可以只写下面这行的代码
            // return this.age - o.age;
        }

    public Student() {
        super();
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Student student = (Student) super.clone();
        student.m = (Money) this.m.clone();
        return student;
    }
}
